import { axios } from "src/boot/axios";

const userApi = {
  Login: "/login",
  mobileLogin: "/api/front/login/mobile",
  Logout: "/logout",
  // get my info
  UserInfo: "/getInfo",
};

/**
 * login func
 * @param parameter
 * @returns {*}
 */
export function loginByPassword(parameter) {
  return axios({
    url: userApi.Login,
    method: "post",
    data: parameter,
  });
}

export function getUserInfo() {
  return axios({
    url: userApi.UserInfo,
    method: "get",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
  });
}

export function logout() {
  return axios({
    url: userApi.Logout,
    method: "delete",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
  });
}

// 获取验证码
export function getCodeImg() {
  return axios({
    url: "/captchaImage",
    method: "get",
  });
}
